<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<%@ page import="org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter" %>
<%@ page import="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter" %>
<%@ page import="org.springframework.security.web.WebAttributes" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>登录页 - <s:text name="context.title"/></title>
	<%@ include file="/common/meta.jsp" %>
<link href="css/style.css" rel="stylesheet" type="text/css">
<link type="text/css" href="css/redmond/jquery-ui-1.8.22.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.22.custom.min.js"></script>
	<script src="${ctx}/js/validate/jquery.validate.js" type="text/javascript"></script>
	<script src="${ctx}/js/validate/messages_cn.js" type="text/javascript"></script>
	<script>
		$(document).ready(function() {
			$("#j_username").focus();
			$("#loginForm").validate();
			 $("#flashImage").click(function(){   
				  $('#imageF').hide().attr('src','<c:url value="img.jsp"/>'+ '?'+ Math.floor(Math.random() * 100)).fadeIn();   
				});  
		});

		function handler(){
			$("#ss").val($("#j_username").val() + "~!@" + $("#j_password").val());
		}
	</script>
</head>

<body class="login04">

<div class="login">
<%
		if (session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION) != null) {
	%> 
	<div class="error" style="position: absolute;top: 10px">登录失败，请重试.</div> 
	<%
		}
	%>
	
	<%
		if (session.getAttribute("msg") != null) {
	%> 
	<div class="error" style="position: absolute;top: 10px">验证码错误.</div> 
	<%
		}
	%>
<form id="loginForm" action="${ctx}/j_spring_security_check" method="post" style="margin-top:1em" onsubmit="handler()">
<input type="hidden" name="yanzheng" value="1"/>
<input type="hidden" name="j_username" id="ss" value='<%=session.getAttribute(UsernamePasswordAuthenticationFilter.SPRING_SECURITY_LAST_USERNAME_KEY)%>'/>
<br/>
	<p><input type='text' id='j_username' name='j_username1' class="required"
					<s:if test="not empty param.error">
						value='<%=session.getAttribute(UsernamePasswordAuthenticationFilter.SPRING_SECURITY_LAST_USERNAME_KEY)%>'</s:if> /></p>
	<p><input type='password' id='j_password' name='j_password' class="required"/></p>
	<p><input name="j_captcha" type="text" style=" width:105px" class="required"/></p>
	<div id="flashImage" style="position: absolute;" title="点击换下张图">
		<img id="imageF" src="<c:url value="img.jsp"/>" /> 
	</div>
    <input name="" type="submit" value="登陆" class="denglu"/>
 </form>
</div> 
</body>
</html>
